﻿using System;
using System.Collections.Generic;
using Sustainalytics.CompanyScreening.Model;
using Sustainalytics.Entities;
using Sustainalytics.Utils;

namespace Sustainalytics.CompanyScreening
{
    public interface ICompanyScreening
    {
        CurrentFilterDetails GetCurrentFilterDetails(string username);


        List<CriteriaTypeOne> ListSelectedCriteriaTypeOne(Guid filterId);
        List<CriteriaTypeTwo> ListSelectedCriteriaTypeTwo(Guid filterId);
        List<CriteriaTypeThree> ListSelectedCriteriaTypeThree(Guid filterId);

        List<CriteriaTypeFive> ListSelectedCriteriaTypeFive(Guid filterId);
        List<CriteriaTypeSix> ListSelectedCriteriaTypeSix(Guid filterId);

        CriteriaTypeOne AddCriteriaTypeOne(Guid templateId, int minValue, int maxValue, string username);
        List<BaseCriteria> ListBaseCriteria();
        List<CriteriaLevel1> ListCriteriaLevelOne();
        List<CriteriaLevel2> ListCriteriaLevelTwo();
        CriteriaTypeOne LoadCriteriaTypeOne(Guid criteriaTemplateId);
        List<CriteriaChartData> LoadCriteriaTypeOneData(Guid criteriaTemplateId);
        void UpdateCriteriaTypeOne(string username, Guid criteriaId, int minValue, int maxValue);
        List<Guid> ProcessCriteriaTypeOne(CriteriaTypeOne criteria, Guid? portfolioId);
        CriteriaTypeTwo AddCriteriaTypeTwo(Guid templateId, int? score, string username);
        CriteriaTypeTwo LoadCriteriaTypeTwo(Guid criteriaTemplateId);
        void UpdateCriteriaTypeTwo(string username, Guid criteriaId, int? score);
        List<Guid> ProcessCriteriaTypeTwo(CriteriaTypeTwo criteria, Guid? portfolioId);
        List<Guid> ProcessCriteriaTypeThree(CriteriaTypeThree criteria, Guid? portfolioId);
        void UpdateSelectedCriteriaOrderNumber(string username, Guid filterId, List<Guid> criteriaIds);
        void DeleteCriteria(string username, Guid criteriaId);
        CriteriaTypeThree AddCriteriaTypeThree(Guid criteriaTemplateId, string collectionName, List<string> list, string userName);
        void UpdateCriteriaTypeThree(string username, Guid criteriaTemplateId, string collectionName, List<string> selectedItems);
        CriteriaTypeThree LoadCriteriaTypeThree(Guid templateId);
        object GetCriteriaByID(Guid criteriaId, int criteriaType);
        List<string> LoadCriteriaTypeThreeData(Guid templateId, int skip, int take, string filter, out int totalCount);
        void RunSelectedCriteria(Guid filterId);
        PagedList<ResultOutput> GetResultOutput(ResultOutputFilter filter, PagingOptions pagingOptions, string orderBy = null, bool asc = true);
        void ClearResultOutput(Guid filterId);
        void DeleteAllCriteria(string username, Guid filterId);



        List<Guid> ProcessCriteriaTypeFive(CriteriaTypeFive criteria, Guid? portfolioId);
        CriteriaTypeFive AddCriteriaTypeFive(Guid templateId, int? score, string templateIndicatorNumber, string username);
        CriteriaTypeFive LoadCriteriaTypeFive(Guid criteriaTemplateId);
        CriteriaTypeFive LoadTemplateCriteriaTypeFive(Guid criteriaTemplateId);
        void UpdateCriteriaTypeFive(string username, Guid criteriaId, int? score, string templateIndicatorNumber);

        List<Guid> ProcessCriteriaTypeSix(CriteriaTypeSix criteria, Guid? portfolioId);
        CriteriaTypeSix AddCriteriaTypeSix(Guid templateId, int minValue, int maxValue, string username);
        CriteriaTypeSix LoadCriteriaTypeSix(Guid criteriaTemplateId);
        List<CriteriaChartData> LoadCriteriaTypeSixData(Guid criteriaTemplateId);
        void UpdateCriteriaTypeSix(Guid criteriaId, int minValue, int maxValue, string username);

        #region load filter
        List<UserFilterDetails> GetLastUsedFilters(string userName);

        List<UserFilterDetails> GetUsersFilters(string userName);

        CurrentFilterDetails LoadSavedFilter(string userName, Guid sourceRootFilterId);

        #endregion

        RootFilterDetails SaveCurrentFilter(string userName, string filterName, bool shared, bool createNew);

        List<ResultOutput> GetFullResultOutput(ResultOutputFilter filter);
    }
}
